﻿830.较大分组的位置
/**
 * Return an array of arrays of size *returnSize.
 * The sizes of the arrays are returned as *returnColumnSizes array.
 * Note: Both returned array and *columnSizes array must be malloced, assume caller calls free().
 */
int** largeGroupPositions(char* s, int* returnSize, int** returnColumnSizes) {
    int** ans = (int**)malloc(sizeof(int*) * (strlen(s) / 3));
    *returnColumnSizes = (int*)malloc(sizeof(int) * (strlen(s) / 3));
    *returnSize = 0;
    int count = 1;
    for (int i = 0; i < strlen(s); i++)
    {
        if (i == strlen(s) - 1 || s[i] != s[i + 1])
        {
            if (count >= 3)
            {
                (*returnColumnSizes)[(*returnSize)] = 2;
                ans[(*returnSize)] = (int*)malloc(sizeof(int) * 2);
                ans[(*returnSize)][0] = i - count + 1;
                ans[(*returnSize)++][1] = i;
            }
            count = 1;
        }
        else
        {
            count++;
        }
    }
    return ans;
}



